package com.hujing.springsource.a01;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class Component1 {

    @Autowired
    private ApplicationEventPublisher publisher;

    public void register(){
        log.info("用户注册");
        //发送短信
        publisher.publishEvent(new UserRegisterEvent(this));
    }
}
